package com.flick.baseService.impl;

import com.flick.baseService.BaseServ;
import com.flick.common.Page;
import com.flick.common.PageParam;
import com.flick.dao.MongoDbDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by flick on 2017/4/23.
 */
@Service
public abstract class BaseServImpl<T> implements BaseServ<T> {

    @Autowired
    MongoDbDao<T> dao;

    @Override
    public List<T> list() {
        return (List<T>) dao.list(null);
    }
    @Override
    public Page page(PageParam pageParam) {
        Page page = dao.page(pageParam.getPageNum(),pageParam.getPageSize(),
                pageParam.getSidx(),pageParam.getSord(),pageParam.getFilters());
        return page;
    }
    @Override
    public T get(String id) {
         return (T) dao.get(id);
    }
}
